
result = run_command('find', '.', '-name', '*.c', check:true)
if result.returncode() == 0
    files_found = result.stdout().strip().split('\n')
else
    error('Failed to find .c files')
endif
c_files = files(files_found)

c_args = []
libnow = library(target_name,
  sources : [c_files],
  version : target_version,
  soversion : major_version,
  install : install_flag,
  include_directories : join_paths(include_prefix, target_name),
  dependencies : [
    gio_dep, glib_dep,
    libgpiod_dep,
    ],
  link_args: ['-lm'],
  c_args : c_args,
  objc_args : c_args,
  install_dir: install_dir,
  )
dep = dependency(target_name, required: false)
if dep.found()
  message('Found some_dependency')
else
  message('some_dependency not found, creating a custom dependency')
  dep = declare_dependency(
    link_with : libnow,
    dependencies : [],
    include_directories : join_paths(include_prefix, target_name),
    )
endif
libgpio_dep = dep
libgpio_dep = declare_dependency(
  sources: c_files,
  include_directories: join_paths(include_prefix, target_name),
  dependencies: [
    gio_dep, glib_dep,
    libgpiod_dep,
    ],
)
